package org.agile4j.patterns.prototype.prototypemanager;

public class Client {
	public static void main(String[] args) {
		try {
			Prototype p1 = new ConcretePrototype1();
			PrototypeManager.setPrototype("hyx", p1);
			Prototype p11 = PrototypeManager.getPrototype("hyx").clone();
			p11.setName("p11111111");
			System.out.println("第一個實例:" + p11);
			
			Prototype p2 = new ConcretePrototype2();
			PrototypeManager.setPrototype("hyx", p2);
			Prototype p22 = PrototypeManager.getPrototype("hyx").clone() ;
			p22.setName("p22222222");
			System.out.println("第二個實例:" + p22);
			
//			PrototypeManager.removePrototype("hyx");
			
			Prototype p33 = PrototypeManager.getPrototype("hyx").clone() ;
			p33.setName("p33333");
			System.out.println("第三實例:" + p33);
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}
